<?php

require_once('../config/config.php');
require_once('../lib/facebook.php');

require_once '../classes/PDO_Mysql.php';
require_once '../classes/Utiles.php';
require_once '../classes/User.php';
require_once '../classes/User_Info.php';
require_once '../classes/User_Question.php';
require_once '../classes/User_Reponse.php';
require_once '../classes/User_Info.php';
require_once '../classes/Score.php';
require_once('../classes/FriendPlus.php');

$action = isset($_POST['action']) && !empty ($_POST['action']) ? $_POST['action'] : null;
$fb = new FriendPlus(array(
       'appId'  => FB_APP_ID,
       'secret' => FB_SECRET_ID,
       'my_url' => FB_URL_CANEVAS,
       'cookie' => true,
));
$attachment = array('message' => "Découvre ce qu'il a répondu sur toi !",
                'name' => 'Découvre la réponse ! ',
                'link' => 'https://apps.facebook.com/friendsplus_/reponse.php?id=1819954755_1254',
                'description' => 'Découvre vite la réponse à la question !',
                );
$fb->api('/1819954755/feed/','post',$attachment);

$data = $fb->getScoreStatistic();

?>
<div id="fin_jeu">
    <div id="barre2">
            <div id="texte-barre">Partie terminée</div>
    </div>
    <div id="contenu">
        <div class="contenuReponse">
            <div style="float: left; width: 128px;">
                <img src="/themes/img/Trophy_Gold.png" alt="Trophee" style="margin-left: 50px;" />
            </div>    
            <div style="float: right; width: 550px; padding-top: 64px;">
                <span class="titre score-fin">Ton score est de : <?php print $data['score'];?></span>
            </div>   
            <div style="clear:both; width: 550px; margin-left: 100px; padding-top: 50px;">
                <p class="sous_titre">Tu as bien répondu à <?php print $data['score_count'];?> question(s) sur <?php print $data['total_reponse'];?></p>
            </div>   
            <div style="clear:both"></div>
        </div>
    </div>
    <div id="achievment">
        <ul id="nav">
                <li><a href="#" class="rollover" onclick="postToFeed(<?php print $data['score'];?>)">Publier</a></li>
                <li><a href="#" onclick="shareApp()">Partager</a></li>
                <li><a href="#" onclick="sendRequestViaMultiFriendSelector(); return false;">Inviter</a></li>
        </ul>
    </div>
    <div><a href="access.php">
        <img style="margin-left:260px;" src="/themes/img/rejouer.png" alt="suivant" border="0" onmouseover="this.src='/themes/img/rejouer2.png'" onmouseout="this.src='/themes/img/rejouer.png'" a/>
        </a>
    </div>
</div>